package com.mnxc.gxa.controller;


import com.mnxc.gxa.dto.Result;
import com.mnxc.gxa.service.IUserRoleService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mnxc
 * @since 2023-06-29
 */
@RestController
@RequestMapping("/userRole")
public class UserRoleController {
    @Resource
    IUserRoleService userRoleService;

    public UserRoleController() {
    }

    @GetMapping({"/{userId}"})
    public Result getRolesByUserId(@PathVariable Integer userId) {
        return this.userRoleService.getRolesByUserId(userId);
    }

    @PutMapping({"/{userId}/{roleIds}"})
    public Result changeUserRoles(@PathVariable List<Long> roleIds, @PathVariable Long userId) {
        return this.userRoleService.changeUserRoles(roleIds, userId);
    }
}

